<script setup>
  import { ref } from 'vue';
  import axios from 'axios'

  let fun1 = function() {
    let promistResult = axios({
      url: '/ficsFleetServices/home/page/efficiencyTrend',
      method: 'get',
      // 参数配置在data中，参数会以json串放在请求体中，所以必须是post请求
      data: {},
      // 参数配置在params中，参数都是以键值对拼接在url后面的，不管是什么请求
      params: {
        organizeId: '669801850404942853',
        fleetId: null,
        dateTimeFlag: 'year'
      }
    })

    promistResult.then(
      function(response){
        console.log(response)
      }
    ).catch(
      function(error){
        console.log('异常捕获：', error)
      }
    )
  }

  let fun2 = function() {
    let promistResult = axios({
      url: '/api/rand.qinghua',
      method: 'get',
      data: {
        format: 'json'
      },
      params: {}
    })

    promistResult.then(
      function(response){
        console.log(response)
      }
    ).catch(
      function(error) {
        console.log('异常捕获', error)
      }
    )
  }


</script>

<template>
  <div>
    <h3>hello</h3><br>
    <input v-bind:type="'button'" v-bind:value="'get请求'" v-on:click="fun1()"/>
    <input v-bind:type="'button'" v-bind:value="'post请求'" v-on:click="fun2()"/>
  </div>
</template>

<style scoped>

</style>
